int width, height;
float resource_scale;
- if (!st_widget_get_resource_scale (ST_WIDGET (self), &resource_scale))
- {
- ClutterActorBox empty = CLUTTER_ACTOR_BOX_INIT_ZERO;
- clutter_actor_set_allocation (self, &empty);
- return;
- }
+ resource_scale = clutter_actor_get_resource_scale (self);
clutter_actor_set_allocation (self, box);
st_theme_node_get_content_box (theme_node, box, &content_box);
float resource_scale;
ClutterContent *content = clutter_actor_get_content (CLUTTER_ACTOR (self));
- if (st_widget_get_resource_scale (ST_WIDGET (self), &resource_scale))
- clutter_canvas_set_scale_factor (CLUTTER_CANVAS (content), resource_scale);
+ resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
+ clutter_canvas_set_scale_factor (CLUTTER_CANVAS (content), resource_scale);
}
static void
content = clutter_actor_get_content (CLUTTER_ACTOR (area));
clutter_content_get_preferred_size (content, &w, &h);
- if (st_widget_get_resource_scale (ST_WIDGET (area), &resource_scale))
- {
- w /= resource_scale;
- h /= resource_scale;
- }
- else
- {
- w = h = 0.0f;
- }
+ resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (area));
+
+ w /= resource_scale;
+ h /= resource_scale;
if (width)
*width = ceilf (w);
if (shadow_spec)
{
+ ClutterActorBox allocation;
+ float width, height;
float resource_scale;
- if (clutter_actor_get_resource_scale (priv->label, &resource_scale))
+ clutter_actor_get_allocation_box (priv->label, &allocation);
+ clutter_actor_box_get_size (&allocation, &width, &height);
+
+ resource_scale = clutter_actor_get_resource_scale (priv->label);
+
+ width *= resource_scale;
+ height *= resource_scale;
+
+ if (priv->text_shadow_pipeline == NULL ||
+ width != priv->shadow_width ||
+ height != priv->shadow_height)
+ {
+ g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref);
+
+ priv->shadow_width = width;
+ priv->shadow_height = height;
+ priv->text_shadow_pipeline =
+ _st_create_shadow_pipeline_from_actor (shadow_spec,
+ priv->label);
+ }
+
+ if (priv->text_shadow_pipeline != NULL)
{
- ClutterActorBox allocation;
- float width, height;
-
- clutter_actor_get_allocation_box (priv->label, &allocation);
- clutter_actor_box_get_size (&allocation, &width, &height);
-
- width *= resource_scale;
- height *= resource_scale;
-
- if (priv->text_shadow_pipeline == NULL ||
- width != priv->shadow_width ||
- height != priv->shadow_height)
- {
- g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref);
-
- priv->shadow_width = width;
- priv->shadow_height = height;
- priv->text_shadow_pipeline =
- _st_create_shadow_pipeline_from_actor (shadow_spec,
- priv->label);
- }
-
- if (priv->text_shadow_pipeline != NULL)
- {
- CoglFramebuffer *framebuffer;
-
- framebuffer =
- clutter_paint_context_get_framebuffer (paint_context);
- _st_paint_shadow_with_opacity (shadow_spec,
- framebuffer,
- priv->text_shadow_pipeline,
- &allocation,
- clutter_actor_get_paint_opacity (priv->label));
- }
+ CoglFramebuffer *framebuffer;
+
+ framebuffer =
+ clutter_paint_context_get_framebuffer (paint_context);
+ _st_paint_shadow_with_opacity (shadow_spec,
+ framebuffer,
+ priv->text_shadow_pipeline,
+ &allocation,
+ clutter_actor_get_paint_opacity (priv->label));
}
}
float resource_scale;
guint8 opacity;
- if (!st_widget_get_resource_scale (widget, &resource_scale))
- return;
+ resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (widget));
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
theme_node = st_widget_get_theme_node (widget);
st_widget_get_resource_scale (StWidget *widget,
float *resource_scale)
{
- return clutter_actor_get_resource_scale (CLUTTER_ACTOR (widget),
- resource_scale);
+ if (resource_scale)
+ *resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (widget));
+
+ return TRUE;
}
static void